package com.bestom.bluetoothlock.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;


import com.bestom.bluetoothlock.R;
import com.bestom.bluetoothlock.entity.FingerInfo;

import java.util.ArrayList;
import java.util.List;

public class FingerMangeAdapter extends BaseAdapter {
    private List<FingerInfo> list = new ArrayList();
    private Context mContext;
    /* access modifiers changed from: private */
    public OnRightClickListener mOnRightClickListener;

    public interface OnRightClickListener {
        void onRightClick(View view, int i);
    }

    public long getItemId(int i) {
        return (long) i;
    }

    public FingerMangeAdapter(Context context) {
        this.mContext = context;
    }

    public void setData(List<FingerInfo> list2) {
        this.list = list2;
        notifyDataSetChanged();
    }

    public List<FingerInfo> getList() {
        return this.list;
    }

    public int getCount() {
        return this.list.size();
    }

    public Object getItem(int i) {
        return this.list.get(i);
    }

    public View getView(int i, View view, ViewGroup viewGroup) {
        View view2;
        ViewHolder viewHolder;
        if (view == null) {
            viewHolder = new ViewHolder();
            view2 = LayoutInflater.from(this.mContext).inflate(R.layout.device_details_list_item, (ViewGroup) null);
            viewHolder.tv_name = (TextView) view2.findViewById(R.id.item_name);
            viewHolder.tv_id = (TextView) view2.findViewById(R.id.item_id);
            viewHolder.tv_delete = (Button) view2.findViewById(R.id.tv_right);
            viewHolder.tv_delete.setTag(Integer.valueOf(i));
            view2.setTag(viewHolder);
        } else {
            view2 = view;
            viewHolder = (ViewHolder) view.getTag();
        }
        TextView textView = viewHolder.tv_id;
        textView.setText("ID:" + this.list.get(i).getFingerid());
        viewHolder.tv_name.setText(this.list.get(i).getFingername());
        viewHolder.tv_delete.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                int intValue = ((Integer) view.getTag()).intValue();
                if (FingerMangeAdapter.this.mOnRightClickListener != null) {
                    FingerMangeAdapter.this.mOnRightClickListener.onRightClick(view, intValue);
                }
            }
        });
        return view2;
    }

    public void setOnRightClickListener(OnRightClickListener onRightClickListener) {
        this.mOnRightClickListener = onRightClickListener;
    }

    public final class ViewHolder {
        Button tv_delete;
        TextView tv_id;
        TextView tv_name;

        public ViewHolder() {
        }
    }
}
